<template>
    <div class="flexbetween">
        <div class="inputMain">
            <el-form ref="form" :model="form" label-width="100px">
                <el-row :gutter="10">
                    <el-col :span="6" v-if="type == 'unit'">
                        <el-form-item label="姓名">
                            <el-input size="small" v-model="form.contactsName" placeholder="请输入姓名"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6" v-if="type == 'unit'">
                        <el-form-item label="手机号">
                            <el-input size="small" v-model="form.contactsPhone" placeholder="请输入手机号"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6" v-if="type == 'company'">
                        <el-form-item label="企业名称">
                            <el-input size="small" v-model="form.contactsEnterpriseName" placeholder="请输入企业名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="认证状态">
                            <el-select size="small" v-model="form.isAuth">
                                <el-option label="全部" value=""></el-option>
                                <el-option label="未认证" value="0"></el-option>
                                <el-option label="已认证" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </div>
        <div class="btnMain">
            <el-button size="small" type="primary" @click="search()">搜索</el-button>
            <el-button size="small" @click="reset">重置</el-button>
        </div>
    </div>
</template>

<script>
export default {
    props: ['type'],
    data() {
        return {
            form: {
                contactsEnterpriseName: "",//企业名称
                contactsName: "",//姓名
                contactsPhone: "",//手机号
                isAuth: ""//认证状态
            },
            show: true,
        }
    },
    methods: {
        changeShow(type) {
            if (type == 1) {
                this.show = false
            } else if (type == 2) {
                this.show = true
            }
        },
        search() {
            if (this.type == "company") {
                this.$emit("Listsearch", this.form)
            } else {
                this.$bus.$emit('getPersonsearch', this.form)
            }
        },
        reset() {
            for (var key in this.form) {
                this.form[key] = "";
            }
            this.$emit("Listsearch", this.form)
        }
    }
}
</script>

<style lang="scss">
.inputMain {
    .el-date-editor--daterange.el-input__inner {
        width: 100%;
    }

    .el-form-item {
        margin-bottom: 16px;
    }

    .el-button--mini {
        padding: 5px 7px;
    }
}
</style>

<style lang="scss" scoped>
.inputMain {
    width: 70%;
}

.btnMain {
    align-self: flex-start;

    .active {
        transform: rotate(90deg);
        padding-left: 9px;
        padding-right: 9px;
    }
}</style>